﻿using Kaskelot.SP.Model.Client;
using Kaskelot.SP.Model.Contracts;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Kaskelot.SP.Services.Client.Mapping
{
    public static class ClientDokumentExtensions
    {
        public static ClientDokument ToClientContract(this Document entity)
        {
            ClientDokument d = new ClientDokument();

            CopyFromEntity(entity, d);

            return d;
        }

        private static void CopyFromEntity(Document from, ClientDokument to)
        {
            to.DocumentItemId = from.Id.ToString();
            to.FilNamn = from.FileName;
            to.Url = from.Url;
            to.Skapad = from.Skapad != null ? from.Skapad.ToShortDateString() : null;
            to.Andrad = from.Andrad != null ? from.Andrad.ToShortDateString() : null;
            //to.AndradAv = from.AndradAv;
            
            //to.SkapadAv = from.SkapadAv;
        }
    }
}
